#pragma once
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <stdio.h>
#include <fstream>
#include <sstream>
#include <limits>
#include "getopt.h"
#include "RKUtils.h"


using namespace std;

const int R256_MOD_MAX  =      65479;    
const int R160_MOD_MAX  =    8387999;    
const int R128_MOD_MAX  =   16699901;    
const int R64_MOD_MAX   =   33499997;    
const int R48_MOD_MAX   =   38299999;    
const int R32_MOD_MAX   =   59599993;    
const int R16_MOD_MAX   =   89399987;    
const int R8_MOD_MAX    =  268399993;   
const int R4_MOD_MAX    =  536799997;   
const int R2_MOD_MAX    = 1073499991;  


class cProgramOptions
{
private:
    char *dbDirectory_;  // directory for the BDB databse
    char *dbName_;       // name of the BDB database
    char *tfPath_;       // input text file name
    char *rfName_;       // results file name
    char *sPattern_;      // pattern to search for
    int  radix_;
    int  modulus_;
    int  windowSize_;
    int  mbPerTime_;
    bool isGenerate_;   // T if 
    bool isVerbose_;
    bool isHelp_;
    bool isWrite_;
    bool isReplace_;
    bool isSearch_;
    bool isVerify_;
public:
    cProgramOptions(int argc, _TCHAR *const *argv);
    cProgramOptions();
    ~cProgramOptions(void);
    void setDefaults(void);
    void checkOptions(void);
    void helpOptions(void);
    void readConfigFile(bool OptionByCommandLine[]);
    void parseOptions(bool isCmdLine, int pOption, const _TCHAR* pOptArg, bool optArray[]);
    void verifyOptions(void);
    string bldShortOptions(const struct option long_options[]);
    string getTextFile(void)            {return (tfPath_);};
    string getResultsFile(void)         {return (rfName_);};
    string getPattern(void)             {return (sPattern_);};
    string getdbDirectory(void)         {return (dbDirectory_);};
    string getdbName(void)              {return (dbName_);};
    void setDefaultModulus(void);
    int  getRadix()                     {return (radix_);};
    int  getModulus()                   {return (modulus_);};
    int  getWindowSize()                {return (windowSize_);};
    int  getMbPerTime()                 {return (mbPerTime_);};
    bool isGenerate()                   {return (isGenerate_);};
    bool isVerbose()                    {return (isVerbose_);};
    bool isHelp()                       {return (isHelp_);};
    bool isWrite()                      {return (isWrite_);};
    bool isReplace()                    {return (isReplace_);};
    bool isSearch()                     {return (isSearch_);};
    bool isVerify()                     {return (isVerify_);};

};